package com.woniu.aimd.controller;

import cn.dev33.satoken.util.SaResult;
import com.woniu.aimd.pojo.DTO.TeacherClassInfoDTO;
import com.woniu.aimd.pojo.entity.TeacherClass;
import com.woniu.aimd.service.TeacherclassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("tc")
public class TeacherclassController {
    @Autowired
    private TeacherclassService teacherclassService;

    /**
     * 根据用户id（教师id）获取教师所带班级信息（班级id，专业名，期数，阶段）
     * @param userId
     * @return
     */
    @GetMapping("getClassInfoByUserid")
    public SaResult getClassInfoByUserid(@RequestParam String userId){
        List<TeacherClassInfoDTO> teacherClassInfo = teacherclassService.getClassInfoByUserid(userId);
        return SaResult.ok().setData(teacherClassInfo);
    }

    /**
     *添加阶段，和管理的老师？
     * @param teacherClass
     * @return
     */
    @PostMapping("insert")
    public SaResult insert(@RequestBody TeacherClass teacherClass){
        teacherclassService.insert(teacherClass);
        return SaResult.ok();
    }
}
